package com.technology.education.dslitem.module

import com.angcyo.dsladapter.DslAdapterItem
import com.angcyo.dsladapter.DslViewHolder
import com.technology.education.R
import com.technology.education.ext.getColor
import com.technology.education.ext.getMiddleColor

/**
 *@author:create by BZY
 *Date: 2022/3/23 12
 */
class ItemOrderStatusCountdown(var status: String, var tag: String,var title:String="已等待") : DslAdapterItem() {
    init {
        itemLayoutId = R.layout.item_order_status_countdown
    }

    override fun onItemBind(
        itemHolder: DslViewHolder,
        itemPosition: Int,
        adapterItem: DslAdapterItem,
        payloads: List<Any>
    ) {
        super.onItemBind(itemHolder, itemPosition, adapterItem, payloads)
        itemTag = tag
        if (payloads.isNotEmpty()){
            status=payloads[0].toString()
        }
        itemHolder.tv(R.id.tv_status)?.apply {
            text = getMiddleColor(
                title, if (payloads.isEmpty()) status else payloads[0].toString(), "",
                getColor(R.color.yellow)
            )
        }
    }
}